home *** CD-ROM | disk | FTP | other *** search
/ Ray Dream Studio / Ray Dream Studio (CDRAYD1) (Ray Dream) (1995).iso / DREAMSDK.WIN / INCLUDE / I3DSHOBJ.H < prev    next >
C/C++ Source or Header  |  1995-10-18  |  12KB  |  251 lines

  1. /* $Id: I3DSHOBJ.H 1.3 1995/10/06 21:14:17 YannPC Exp $ */
  2. /*****************************************************************************\
  3. *                                                                             *
  4. * I3DShObj.h                                                                                *
  5. *   I3DShObject                                                               *
  6. *   I3DShPrimitive                                                            *
  7. *   I3DShPolygonList                                                          *
  8. *   I3DShPolygonArray                                                          *
  9. *   I3DShPatchArray                                                            *
  10. *   I3DShFlatSurface                                                          *
  11. *                                                                             *
  12. *           Copyright (c) 1995, Ray Dream, Inc. All rights reserved.          *
  13. *                                                                             *
  14. \*****************************************************************************/
  15.  
  16. #ifndef __I3DSHOBJ__
  17. #define __I3DSHOBJ__
  18.  
  19. #ifndef __3DCOTYPE__
  20. #include "3DCoType.h"
  21. #endif
  22.  
  23.  
  24. //****** Globally Unique Ids **************************************************
  25.  
  26. DEFINE_GUID(IID_I3DShObject, 0xBDEA68A0L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  27. DEFINE_GUID(IID_I3DShPrimitive, 0x5C9601A7L, 0x7CC3, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  28. DEFINE_GUID(IID_I3DShPolygonList, 0xBFBEDA80L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  29. DEFINE_GUID(IID_I3DShPolygonArray, 0xC1840A20L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  30. DEFINE_GUID(IID_I3DShPatchArray, 0xC361A3C0L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  31. DEFINE_GUID(IID_I3DShFlatSurface, 0xC546DE80L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  32.  
  33. //-- The following classes are available in Ray Dream Designer:
  34. DEFINE_GUID(CLSID_StandardPolygonList, 0xC756D2C0L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  35. DEFINE_GUID(CLSID_StandardPolygonArray, 0xCA395940L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  36. DEFINE_GUID(CLSID_StandardPatchArray, 0xCBF56120L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  37. DEFINE_GUID(CLSID_StandardFlatSurface, 0xCDC9D300L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  38.  
  39. struct ShadingShape;
  40. class I3DShShader;
  41.  
  42.  
  43. /*****************************************************************************\
  44. *  I3DShObject                                                                *
  45. *                                                                             *
  46. *    I3DShObject contain the geometry and shading information of the objects    *
  47. *    in a scene.                                                                                                     *
  48. *    They are kept in a list in the scene (the Objects List), and can be             *
  49. *    instanciated as many times as needed in a scene.                         *                           *
  50. *                                                                             *
  51. *    There are two types of Objects: Primitives and Scenes (a Scene can be    *
  52. *    instanciated in another Scene). See I3DShPrimitive and I3DShScene.       *
  53. *                                                                             *
  54. \*****************************************************************************/
  55.  
  56. #undef  INTERFACE
  57. #define INTERFACE   I3DShObject
  58.  
  59. DECLARE_INTERFACE_(I3DShObject, IUnknown) {
  60.     // IUnknown methods
  61.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  62.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  63.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  64.  
  65.     // I3DShObject methods
  66.     //-- Naming
  67.     STDMETHOD(SetName) (THIS_ char* name) PURE;
  68.     STDMETHOD(GetName) (THIS_ char* name) PURE;
  69.     //-- Shading calls
  70.     STDMETHOD(SetSimpleShading) (THIS_ COLOR3D* color, NUM3D specularIntensity, NUM3D specularIndex, NUM3D reflection, NUM3D transparency) PURE;
  71.     STDMETHOD(SetPrimerShader) (THIS_ I3DShShader* primerShader) PURE;
  72.     STDMETHOD_(ULONG, GetUVSpaceCount) (THIS) PURE;
  73.     STDMETHOD(GetUVSpace) (THIS_ ULONG uvSpaceID, UVSpaceInfo* uvSpaceInfo) PURE;
  74.     STDMETHOD(AddShadingShape) (THIS_ ShadingShape* shadingShape, ULONG uvSpaceID) PURE;
  75.     };
  76.  
  77. /*****************************************************************************\
  78. *  I3DShPrimitive                                                             *
  79. *                                                                             *
  80. *    A Primitive is a simple geometric Object: sphere, polygon list, etc.     *
  81. *    Other interfaces supported: I3DShObject                                  *
  82. *                                                                             *
  83. \*****************************************************************************/
  84.  
  85. #undef  INTERFACE
  86. #define INTERFACE   I3DShPrimitive
  87.  
  88. DECLARE_INTERFACE_(I3DShPrimitive, IUnknown) {
  89.     // IUnknown methods
  90.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  91.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  92.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  93.  
  94.     // I3DShPrimitive methods
  95.     //-- Geometry calls
  96.     STDMETHOD_(BOOLEAN, IsPatchBased) (THIS) PURE;
  97.     STDMETHOD(EnumPatches) (THIS_ EnumPatchesCallback callback, void* privData) PURE;
  98.     STDMETHOD(EnumFacets) (THIS_ EnumFacetsCallback callback, void* privData) PURE;
  99.     };
  100.  
  101.  
  102. /*****************************************************************************\
  103. *  I3DShPolygonList                                                           *
  104. *                                                                             *
  105. *    I3DShPolygonList is simply a bag of triangular facets.                   *
  106. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  107. *                                                                             *
  108. \*****************************************************************************/
  109.  
  110. #undef  INTERFACE
  111. #define INTERFACE   I3DShPolygonList
  112.  
  113. DECLARE_INTERFACE_(I3DShPolygonList, IUnknown) {
  114.     // IUnknown methods
  115.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  116.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  117.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  118.  
  119.     // I3DShPolygonList methods
  120.     //-- Init calls
  121.     STDMETHOD(Init) (THIS_ BOOLEAN hasNormals, BOOLEAN hasUV) PURE;
  122.     STDMETHOD(SetUVSpace) (THIS_ VECTOR2D* minUV, VECTOR2D* maxUV) PURE; // Call this if hasUV is true
  123.     //-- Facets handling
  124.     STDMETHOD(PreAllocateFacets) (THIS_ ULONG nbFacets) PURE;        // Use this if you know in advance how many facets you will build
  125.     STDMETHOD(AddFacet) (THIS_ FACET3D* facet) PURE;
  126.     STDMETHOD_(ULONG, CountFacets) (THIS) PURE;
  127.     STDMETHOD(CalcNormals) (THIS_ NUM3D smoothAngle) PURE;                        // Use this call if you do not know how to make the normals
  128.     };
  129.  
  130. /*****************************************************************************\
  131. *  I3DShPolygonArray                                                          *
  132. *                                                                             *
  133. *    I3DShPolygonArray is a regular array of 3D points and normals.           *
  134. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  135. *                                                                             *
  136. \*****************************************************************************/
  137.  
  138. #undef  INTERFACE
  139. #define INTERFACE   I3DShPolygonArray
  140.  
  141. DECLARE_INTERFACE_(I3DShPolygonArray, IUnknown) {
  142.     // IUnknown methods
  143.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  144.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  145.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  146.  
  147.     // I3DShPolygonArray methods
  148.     //-- Init calls
  149.     STDMETHOD(Init) (THIS_ ULONG uCount, ULONG vCount, BOOLEAN uClosed, BOOLEAN vClosed) PURE;
  150.     //-- Geometry calls
  151.     STDMETHOD(SetVertex) (THIS_ ULONG uIndex, ULONG vIndex, VECTOR3D* vertex, VECTOR3D* normal) PURE;        // normal can be NULL
  152.     STDMETHOD(GetVertex) (THIS_ ULONG uIndex, ULONG vIndex, VECTOR3D* vertex, VECTOR3D* normal) PURE;        // normal can be NULL
  153.     //-- (u,v) calls
  154.     STDMETHOD(MeshSetU) (THIS_ ULONG  uIndex, NUM3D uValue) PURE;
  155.     STDMETHOD(MeshSetV) (THIS_ ULONG  vIndex, NUM3D vValue) PURE;
  156.     STDMETHOD(MeshGetU) (THIS_ ULONG  uIndex, NUM3D* uValue) PURE;
  157.     STDMETHOD(MeshGetV) (THIS_ ULONG  vIndex, NUM3D* vValue) PURE;
  158.     //-- Goodies
  159.     STDMETHOD(CalcUV) (THIS) PURE;                                                // Calculate for you all (u,v) values if you do not know how to make them
  160.     STDMETHOD(CalcNormals) (THIS_ BOOLEAN smooth) PURE;        // Calculate for you all normals if you do not know how to make them
  161.     };
  162.  
  163. /*****************************************************************************\
  164. *  I3DShPatchArray                                                            *
  165. *                                                                             *
  166. *    I3DShPatchArray is an array of cubic 4 x 4 Bezier patches.               *
  167. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  168. *                                                                             *
  169. \*****************************************************************************/
  170.  
  171. #undef  INTERFACE
  172. #define INTERFACE   I3DShPatchArray
  173.  
  174. DECLARE_INTERFACE_(I3DShPatchArray, IUnknown) {
  175.     // IUnknown methods
  176.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  177.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  178.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  179.  
  180.     // I3DShPatchArray methods
  181.     //-- Init calls
  182.     STDMETHOD(Init) (THIS_ ULONG uCount, ULONG vCount) PURE;
  183.     //-- Geometry calls
  184.     STDMETHOD(SetPatch) (THIS_ ULONG uIndex, ULONG vIndex, PATCH3D* patch) PURE;
  185.     STDMETHOD(GetPatch) (THIS_ ULONG uIndex, ULONG vIndex, PATCH3D* patch) PURE;
  186.     //-- (u,v) calls
  187.     STDMETHOD(MeshSetU) (THIS_ ULONG uIndex, NUM3D uValue) PURE;
  188.     STDMETHOD(MeshSetV) (THIS_ ULONG vIndex, NUM3D vValue) PURE;
  189.     STDMETHOD(MeshGetU) (THIS_ ULONG uIndex, NUM3D* uValue) PURE;
  190.     STDMETHOD(MeshGetV) (THIS_ ULONG vIndex, NUM3D* vValue) PURE;
  191.     //-- Goodies
  192.     STDMETHOD(CalcUV) (THIS) PURE;                                                // Calculate for you all (u,v) values if you do not know how to make them
  193.     };
  194.  
  195. /*****************************************************************************\
  196. *  I3DShFlatSurface                                                           *
  197. *                                                                             *
  198. *    I3DShFlatSurface is a flat object made of curves and polygons            *
  199. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  200. *                                                                             *
  201. *        Pseudo "grammar" for building 2D curves:
  202. *        FLATSURFACE =
  203. *            BeginFlatSurface
  204. *            GROUP
  205. *            EndFlatSurface
  206. *        
  207. *        GROUP = 
  208. *            BeginGroup
  209. *            GROUP | COMPOUND | PATH                1 or more times
  210. *            EndGroup
  211. *        
  212. *        COMPOUND = 
  213. *            BeginCmpnd
  214. *            GROUP | COMPOUND | PATH                1 or more times
  215. *            EndCmpnd
  216. *        
  217. *        PATH =
  218. *            BeginPath
  219. *            LineTo | BezierTo                            1 or more times
  220. *            EndPath
  221. *                                                                             *
  222. \*****************************************************************************/
  223.  
  224. #undef  INTERFACE
  225. #define INTERFACE   I3DShFlatSurface
  226.  
  227. DECLARE_INTERFACE_(I3DShFlatSurface, IUnknown) {
  228.     // IUnknown methods
  229.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  230.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  231.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  232.  
  233.     // I3DShFlatSurface methods
  234.     //-- Geometry building calls (see grammar above)
  235.     STDMETHOD(BeginFlatSurface) (THIS) PURE;        // Call this before building the surface
  236.     STDMETHOD(EndFlatSurface) (THIS) PURE;            // And this when you are done
  237.     STDMETHOD(BeginGroup) (THIS) PURE;
  238.     STDMETHOD(EndGroup) (THIS) PURE;
  239.     STDMETHOD(BeginCmpnd) (THIS) PURE;                    // Use compounds to make holes
  240.     STDMETHOD(EndCmpnd) (THIS) PURE;
  241.     STDMETHOD(BeginPath) (THIS_ VECTOR2D* firstPoint) PURE;
  242.     STDMETHOD(LineTo) (THIS_ VECTOR2D* secondPoint) PURE;
  243.     STDMETHOD(BezierTo) (THIS_ VECTOR2D* secondPoint, VECTOR2D* thirdPoint, VECTOR2D* fourthPoint) PURE;
  244.     STDMETHOD(EndPath) (THIS) PURE;
  245.     };
  246.  
  247.  
  248.  
  249. #endif
  250.  
  251.